<?php $this->beginBlock('block_script'); ?>
<script type="text/javascript">

    $(function () {
        $("#btn_submit").click(function () {

            var username = $("#username").val();
            var password = $("#password").val();

            if(username == ''){
                showMessage('请输入用户名!');
                return false;
            }

            if(password == ''){
                showMessage('请输入密码!');
                return false;
            }

            $.post('/login/user-login',{username:username,password:password},function(data){

                if(data.code == 200){
                    location.href = '/';
                }else{
                   showMessage(data.msg)
                }

            },'json');
        });

        function showMessage(message) {
            $("#errmsg").text(message);
        }

    });



</script>
<?php $this->endBlock(); ?>


<?php $this->beginContent('@app/views/layouts/adminlte_comm.php'); ?>
<section class="content-header">
    <h1>
        门店订货
        <small>登录</small>
    </h1>
</section>

<!-- Main content -->
<section class="content">
    <div class="row">
        <!-- left column -->
        <div class="col-md-12">
            <!-- general form elements -->
            <div class="box">
                <!-- /.box-header -->
                <!-- form start -->
                <form role="form" id="form_search">
                    <div class="box-body">
                        <input name="username" id="username" class="form-control" placeholder="用户名">
                        <input name="password" id="password" type="password" class="form-control" placeholder="密码">
                    </div>
                    <!-- /.box-body -->
                    <div class="box-footer">
                        <span id="errmsg" style="color: red"></span>
                        <button type="button" class="btn btn-danger pull-right" data-loading-text="Loading..." id="btn_submit">登录</button>
                    </div>
                </form>
            </div>
            <!-- /.box -->
            <div id="div_content">

            </div>


        </div>

    </div>


</section>
<!-- /.content -->

<?php $this->endContent(); ?>



